package test.shortestpath;

import java.util.HashMap;
import java.util.Map;


public class Vertex {

	private int id;
	
	private Map<Vertex, Edge> neighbors;   // Easy to look up neighbor nodes and weight!!
	
	private Vertex prevous;
	private int distance;
	
	public Vertex(int id) {
		this.id = id;
		this.neighbors = new HashMap<Vertex, Edge>();
	}
	
	public Map<Vertex, Edge> getNeighbors() {
		return neighbors;
	}

	public void setNeighbors(Map<Vertex, Edge> neighbors) {
		this.neighbors = neighbors;
	}

	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public Vertex getPrevous() {
		return prevous;
	}
	public void setPrevous(Vertex prevous) {
		this.prevous = prevous;
	}
	public int getDistance() {
		return distance;
	}
	public void setDistance(int distance) {
		this.distance = distance;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Vertex other = (Vertex) obj;
		if (id != other.id)
			return false;
		return true;
	}
	
}
